<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
        <!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="en-US"> <![endif]-->
        <!--[if IE 7]>    <html class="lt-ie9 lt-ie8" lang="en-US"> <![endif]-->
        <!--[if IE 8]>    <html class="lt-ie9" lang="en-US"> <![endif]-->
        <!--[if gt IE 8]><!--> <html lang="cn"> <!--<![endif]-->
        <head>
                <!-- META TAGS -->
                <meta charset="utf-8">
                <meta http-equiv="X-UA-Compatible" content="IE=edge">
                <meta name="viewport" content="width=device-width, initial-scale=1">

                <title>首页 - 知乎</title>

                <link rel="shortcut icon" href="/knife/Public/home_style/images/zhi.png" />


                <!-- Style Sheet-->
                <link rel='stylesheet' id='bootstrap-css-css'  href='/knife/Public/home_style/css/bootstrap5152.css?ver=1.0' type='text/css' media='all' />
                <link rel='stylesheet' id='responsive-css-css'  href='/knife/Public/home_style/css/responsive5152.css?ver=1.0' type='text/css' media='all' />
                <link rel='stylesheet' id='pretty-photo-css-css'  href='/knife/Public/home_style/js/prettyphoto/prettyPhotoaeb9.css?ver=3.1.4' type='text/css' media='all' />
                <link rel='stylesheet' id='main-css-css'  href='/knife/Public/home_style/css/main5152.css?ver=1.0' type='text/css' media='all' />
                <link rel='stylesheet' id='custom-css-css'  href='/knife/Public/home_style/css/custom5152.html?ver=1.0' type='text/css' media='all' />

        
                <style>
                    #My_Big{
                        width: 100%;
                        height: 100%;
                        position: fixed;
                        z-index: 666;
                        display: none;
                    }
                    #back_s{
                        width: 100%;
                        height: 100%;
                        background-color: black;
                        position: fixed;
                        top: 0;
                        opacity: 0.7;
                    }
                    #view_s{
                        width: 500px;
                        background-color: #fff;
                        margin: 20px auto;
                        position: relative;
                        z-index: 5;
                    }
                    #My_title{
                        background-color: blue;
                        /*position: absolute;*/
                        /*z-index: 999;*/
                        color: #fff;
                    }
                    .xs{cursor: pointer;}
                </style>            
    

                <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
                <!--[if lt IE 9]>
                <script src="/knife/Public/home_style/js/html5.js"></script>
                <![endif]-->   

        </head>

        <body>

                <!-- Start of Header -->
                <div class="header-wrapper">
                        <header>
                                <div class="container">


                                        <div class="logo-container" style="margin-left:110px">
                                                <!-- Logo -->
                                                <a href="<?php echo U('Index/index');?>"  title="Knowledge Base Theme">
                                                        <img src="/knife/Public/home_style/images/zhihu.png" width="50" alt="Knowledge Base Theme">
                                                </a>
                                                <span class="tag-line">Know Almost</span>
                                        </div>


                                        <!-- Start of Main Navigation -->
                                        <nav class="main-nav">
                                                <div class="menu-top-menu-container">
                                                        <ul id="menu-top-menu" class="clearfix">
                                                            <li class="current-menu-item"><a href="<?php echo U('Index/index');?>">首页</a></li>
                                                            <?php if ($_SESSION['user']['cover'] == 0 || $_SESSION['user']['cover'] == 1): ?>
                                                                <li><a href="<?php echo U('/Admin/index');?>"> 后台管理 </a></li>
                                                            <?php endif ?>
                                                            <li><a href="#">最新</a></li>
                                                            <li><a href="#">最热</a></li>
                                                            <li><a href="#">关注</a></li>
                                                            <li><a onclick="My_jump();" class="xs">我要提问</a></li>
                                                            <li><a href="#"> </a></li>
                                                            <li> <b style="color:#fff; cursor: pointer;"> 
                                                                <?php if (empty($_SESSION['user']['name'])): ?>
                                                                    <?php echo ($name); ?>
                                                                <?php else: ?>
                                                                    <?php echo $_SESSION['user']['name'] ?>
                                                                <?php endif ?>
                                                             </b>
                                                                    <ul class="sub-menu" id="userHome">
                                                                            <li><a href="<?php echo U('User/index');?>">个人中心</a></li>
                                                                            <li><a href="<?php echo U('Container/onlyYou');?>">我的提问</a></li>
                                                                            <li><a href="<?php echo U('Reply/index');?>">我评论的</a></li>
                                                                            <li><a href="<?php echo U('Index/logOut');?>">退出登陆</a></li>
                                                                    </ul>
                                                            </li>
                                                        </ul>
                                                </div>
                                        </nav>
                                        <!-- End of Main Navigation -->
                                </div>
                        </header>
                </div><!-- End of Header -->

<!-- 弹框,勿动!!! -->
<div id="My_Big">
    <div id="back_s" class="container">
        
    </div>

    <div id="view_s">
        <h3 id="My_title"><span style="margin-left: 20px;">提问</span><span style="margin-left:400px;cursor: pointer;" onclick="my_close()">×</span></h3>
        <form action="<?php echo U('Container/add');?>" method="post">
            <div style="margin-left:3px;">
                <input type="text" name="title" style="width:480px;" placeholder="请写下你的问题...">
                问题说明:   <br> 
                <textarea name="text" style="width: 480px;height: 200px;resize:none;"  placeholder="问题补充..."></textarea>
                <br>
                选择话题:   <br>      
                <input type="text" id="sou" name="tid" style="width:480px;" placeholder="搜索话题...">
                <input type="hidden" name="time" value="<?php echo date('Y-m-d H:i:s');;?>">
                <input type="hidden" name="uid" value="<?php echo $_SESSION['user']['id'];?>">
                <div id="test">
                    <ul style="border:1px solid #999;list-style:none;"></ul>
                </div>
                <div id="My_btn">   
                    <button id="My_return">取消</button>
                    <button id="myCheck">发布</button>
                </div>
            </div>

        </form>
    </div>    
</div>


                




<!-- Start of Page Container -->
<div class="page-container">
    <div class="container">
        <div class="row">

<!-- start of page content -->
<div class="span8 page-content">
        <h1><?php echo ($list['title']); ?> <small> 发表者ID : <?php echo ($list['uid']); ?> </small></h1>
        <hr>
        <h3><?php echo ($list['text']); ?></h3>


		<!-- 以下是评论遍历 -->
		<hr>
		<div class="container">
			<section class="span6 articles-list">
	            <h3>最新评论</h3>
	            <ul class="articles" id="liList">
	                <?php if(is_array($relist)): $i = 0; $__LIST__ = $relist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><li>
	                        <h4><a href="#">评论者ID:<?php echo ($v['uid']); ?></a></h4>
	                        <div class="article-meta"  style="overflow:hidden;text-overflow:ellipsis;">评论内容:<?php echo ($v['text']); ?></div><span class="article-meta">评论时间:<b><?php echo ($v['time']); ?></b><a href="#">顶</a> | <a href="#">踩</a></span>
	                    </li><?php endforeach; endif; else: echo "" ;endif; ?>
	                <hr>
	                <li>没有更多评论...</li>
	            </ul>
	        </section>	
		</div>
        
        <!-- end of page content -->


			<form action="<?php echo U('Reply/add');?>" method="post">
	                <h3>评论:</h3>
	                <textarea name="text" id="myContainer" style="width: 580px;height: 200px;resize:none;"  placeholder="为了给大家营造一个良好的社区环境,请勿发表不良内容,违者将承担法律责任..."></textarea>
	                <br>
	                <input type="hidden" name="time" value="<?php echo date('Y-m-d H:i:s');;?>">
	                <input type="hidden" id="userid" name="uid" value="<?php echo $_SESSION['user']['id'];?>">
	                <input type="hidden" name="cid" value="<?php echo ($list['id']); ?>">
	                <button id="mySub">发布评论</button>
	        </form>	
        

</div>
<!-- end of page content -->
<script type='text/javascript' src='/knife/Public/home_style/js/jquery-1.8.3.min.js'></script>
<script>
//判断是否登陆
	$(function(){

			$("#mySub").click(function(){	
				if ($('#myContainer').val().length < 5) {	
					alert('评论不可少于 5 字');
					return false;
				}
			})
		

		// if ($('#myContainer').val() == '') {
		// 	$("#mySub").click(function(){		
		// 		alert($('#myContainer').val());
		// 		return false;
		// 	})
		// }

		
	})
</script>

        <!-- start of sidebar -->
            <aside class="span4 page-sidebar">
                <section class="widget">
                    <div id="lunbo">
                        <img src="/knife/Public/home_style/images/logo.jpg">
                    </div>
                </section>

                <section class="widget">
                    <div class="quick-links-widget">
                        <h3>大知乎</h3>
                        <ul id="menu-quick-links" class="menu clearfix">
                            <li><a href="index-2.html">知乎圆桌</a></li>
                            <li><a href="articles-list.html">知乎书店</a></li>
                            <li><a href="faq.html">知乎Live</a></li>
                            <li><a href="contact.html">知乎专栏</a></li>
                        </ul>
                    </div>
                </section>

                <section class="widget" style="padding-top:25px">
                    <a href=""><p><img src="/knife/Public/home_style/images/zhi.png" width="30">  相关链接 </p></a>
                    <div>
                        <?php if(is_array($link_list)): $i = 0; $__LIST__ = $link_list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><a href="http://<?php echo ($v["link"]); ?>" class="btn btn-info" style="margin-right:20px;margin-bottom:10px"><?php echo ($v["name"]); ?></a><?php endforeach; endif; else: echo "" ;endif; ?>
                    </div>
                </section>
            </aside>
            <!-- end of sidebar -->
        </div>
    </div>
</div>
<!-- End of Page Container -->



<a href="#top" id="scroll-top"></a>

<!-- script -->
<script type='text/javascript' src='/knife/Public/home_style/js/jquery-1.8.3.min.js'></script>
<script type='text/javascript' src='/knife/Public/home_style/js/jquery.easing.1.3.js'></script>
<script type='text/javascript' src='/knife/Public/home_style/js/prettyphoto/jquery.prettyPhoto.js'></script>
<script type='text/javascript' src='/knife/Public/home_style/js/jflickrfeed.js'></script>
<script type='text/javascript' src='/knife/Public/home_style/js/jquery.liveSearch.js'></script>
<script type='text/javascript' src='/knife/Public/home_style/js/jquery.form.js'></script>
<script type='text/javascript' src='/knife/Public/home_style/js/jquery.validate.min.js'></script>
<script type='text/javascript' src='/knife/Public/home_style/js/custom.js'></script>

<script>
    function My_jump(){
        $('#My_Big').slideDown(800).css('display','block');
        $('#test').css('display','none');
    }
    $(function(){
        $('#My_btn').css('height','36px').css('margin-left','400px');
        $('#My_return').click(function(){ $('#My_Big').css('display','none'); return false; });
        $('#myCheck').click(function(){ if($('#sou').val.length <= 0){ alert('请填写话题分类'); return false; }  });
    })
//通过Ajax方式读取数据库中 与输入内容相关的 话题分类
    $(function(){
        $('#sou').keyup(function(){
            if($('#sou').val() != '') {
                $.ajax({
                    type:'get',
                    url: "<?php echo U('Ajax/index');?>",
                    data: {name:$('#sou').val()},
                    dataType:'json',
                    success:function(data){
                            $('#test ul').empty();
                            $('#test').css('display','block');
                            if (data.length > 0) {
                                for (var i = 0; i < data.length; i++) {
                                    $('<li>'+data[i]['name']+'</li>').appendTo($('#test ul')).click(function(){
                                        $('#sou').val($(this).html());
                                        $('#test').css('display','none');
                                    });
                                }
                            } else {
                                $('<li>未知话题,请尝试搜索其他话题</li>').appendTo($('#test ul')).css('color','red');
                            }
                    }
                })    
            } else {
                $('#test').css('display','none');
            }
            

        });
    })
//通过Ajax方式读取数据库中 与输入内容相关的 问题
    $(function(){
        
            $('#sss').keyup(function(){
                $('#soubox ul').empty();
                if ($('#sss').val() != '') {
                    $.ajax({
                        type:'get',
                        url: "<?php echo U('Ajax/container');?>",
                        data: {title:$('#sss').val()},
                        dataType:'json',
                        success:function(data){
                            $('#soubox').css('display','block');
                            if (data.length > 0) {
                                //console.log(data);
                                for (var i = 0; i < data.length; i++) {
                                    $('<li>'+data[i]['title']+'</li>').appendTo($('#soubox ul')).click(function(){
                                        $('#sss').val($(this).html());
                                        $('#soubox').css('display','none');
                                    });
                                }
                            } else {
                                $('#soubox ul').empty();
                                $('<li>暂无相关问题,请点击屏幕右上角,发起新的提问</li>').appendTo($('#soubox ul')).css('color','red');
                            }
                        }
                    })    
                }
                

            });
        
        
    })
//搜索框 弹出层的样式 和点击事件
    function my_close(){
        $('#My_Big').css('display','none');
    }
    $(function(){
        $('#back_s').click(function(){
            $('#My_Big').css('display','none');
        });
        //搜索Ajax的box样式
        $("#soubox").css('margin-left','75px');
        $("#soubox ul").css('list-style','none').css('width','400px').css('overflow','hidden');
        $("#soubox ul li").css('background-color','#ccc').css('opacity','0.5').bind({
            'mouseover':function(){
                $(this).css('background-color','red');
            },
            'mouseout':function(){
                $(this).css('background-color','#ccc');
            }
        }).click(function(){
            $("#soubox").css('display','none');
        });
        $('#s').change(function(){
            $('#soubox').slideDown(800).css('display','block');
        });
    })
//-----------------------------------
    $(function(){
        //未登录时,隐藏用户的 个人中心 下拉框
        if ($('#menu-top-menu b a').html() == '请登录') {
            $('#userHome').empty();
        }   
    })


</script>
</body>
</html>